//
//  LGConsultStartEndCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/23.
//  咨询开始、结束

#import "LGConsultStartEndCell.h"
#import "LGDottedLineView.h"
@interface LGConsultStartEndCell()
/**   */
@property (nonatomic , strong)LGDottedLineView *leftLine;
/**   */
@property (nonatomic , strong)LGDottedLineView *rightLine;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGConsultStartEndCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}


-(void)fillWithData:(LGCustomCellData *)data{
    [super fillWithData:data];
    self.nameLabel.hidden = YES;
    self.avatarView.hidden = YES;
    self.retryView.hidden = YES;
    NSDictionary *patientDic = data.customDic[@"msgcontent_doctor"];
    self.titleLabel.text = LGNSString(patientDic[@"title"]);
    self.contentLabel.text = LGNSString(patientDic[@"content"]);
    [self.contentLabel lineSpacing:3];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.container.center = self.contentView.center;
}

-(void)createSubView{
    [self.container addSubview:self.leftLine];
    [self.container addSubview:self.titleLabel];
    [self.container addSubview:self.rightLine];
    [self.container addSubview:self.contentLabel];
    [self.leftLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.container);
        make.right.equalTo(self.titleLabel.mas_left).offset(-viewPix(10));
        make.centerY.height.equalTo(self.titleLabel);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.container).offset(5);
        make.centerX.equalTo(self.container);
        make.height.equalTo(@(20));
    }];
    [self.rightLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_right).offset(viewPix(10));
        make.right.equalTo(self.container);
        make.centerY.height.equalTo(self.titleLabel);
    }];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.container).offset(viewPix(20));
        make.right.equalTo(self.container).offset(-viewPix(20));
        make.top.equalTo(self.titleLabel.mas_bottom).offset(viewPix(5));
    }];
}

-(LGDottedLineView *)leftLine{
    if(!_leftLine){
        _leftLine = [[LGDottedLineView alloc]init];
        _leftLine.backgroundColor = [UIColor clearColor];
        _leftLine.lineColor = @"#666666";
        _leftLine.lineDirection = @"horizonta";
    }
    return _leftLine;
}


-(LGDottedLineView *)rightLine{
    if(!_rightLine){
        _rightLine = [[LGDottedLineView alloc]init];
        _rightLine.backgroundColor = [UIColor clearColor];
        _rightLine.lineColor = @"#666666";
        _rightLine.lineDirection = @"horizonta";
    }
    return _rightLine;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(14) textAlignment:NSTextAlignmentCenter lines:1];
    }
    return _titleLabel;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(14) textAlignment:NSTextAlignmentCenter lines:2];
    }
    return _contentLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
